'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  const checkToken = app.middleware.checkToken({
    secret: "xiaoAqianduanzu"
  });

  router.get('/', controller.home.index);
  // router.get('/admin', controller.home.admin_index);

  router.post('/api/v1/login', controller.user.login);
  router.post('/api/v1/register', controller.user.register);

  router.get('/api/v1/plan', controller.plan.allPlans);
  router.post('/api/v1/plan', controller.plan.addPlans);
  router.delete('/api/v1/plan', controller.plan.deletePlans);
  router.put('/api/v1/plan', controller.plan.modifyPlans);

  router.get('/api/v1/diary', controller.diary.allDiarys);
  router.post('/api/v1/diary', controller.diary.addDiarys);
  router.delete('/api/v1/diary', controller.diary.deleteDiarys);
  router.put('/api/v1/diary', controller.diary.modifyDiarys);


  // router.get('/api/v1/verifyUser', controller.user.vertify);
  
  //获取用户信息
  // router.get('/api/v1/userMsg', checkToken, controller.user.userMsg);

  //管理员
  // router.post('/api/v1/admin/login', controller.admin.login);
  // router.get('/api/v1/admin/logout', controller.admin.logout);
  // router.get('/api/v1/admin/verifyAdmin', controller.admin.vertify);


};
